package fragment.tabhostFragment;

import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.ImageView;

import com.lanou.horo.myapplication.R;

import fragment.AbsBaseFragment;
import utils.adapter.FindPageTitleAdapter;

/**
 * 发现fragment
 * Created by dllo on 15/11/17.
 */
public class FindPageFragment extends AbsBaseFragment implements View.OnClickListener {
    private TabLayout tabLayout;
    private ViewPager viewPager;
    private ImageView findPageSearch;


    @Override
    protected int getLayoutView() {
        return R.layout.fragment_page_find;
    }

    @Override
    protected void initView() {
        tabLayout = findView(R.id.findPageTabLayout);
        viewPager = findView(R.id.findPageViewPager);

        findPageSearch = findView(R.id.findPageSearch);

    }


    @Override
    protected void initData() {
        FindPageTitleAdapter adapter = new FindPageTitleAdapter(getFragmentManager());
        viewPager.setAdapter(adapter);
        tabLayout.setupWithViewPager(viewPager);
        findPageSearch.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                goToNext(new SearchFragment());
            }
        });
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.findPageSearch:
                goToNext(new SearchFragment());
                break;
        }
    }
}
